package com.ctn.information.data.retriever.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

import com.ctn.information.data.model.NewsContent;
import com.ctn.information.data.model.NewsTitle;
import com.ctn.information.data.retriever.Retriever;
import com.ctn.information.data.retriever.Interface.NewsContentRetriever;
import com.ctn.information.exception.MethodNotSupportException;
import com.ctn.information.util.JsonUtil;

/**
 * Sample Implementation for test only
 * @author Zale
 *
 */
public class NewsContentRetrieverImpl implements NewsContentRetriever {
	

	@Override
	public NewsContent getById(Long id) throws MethodNotSupportException {
		throw new MethodNotSupportException("Not support");
	}

	@Override
	public List<NewsContent> getAll(boolean asc) throws MethodNotSupportException{
		throw new MethodNotSupportException("Not support");
	}

	@Override
	public NewsContent getContentByInfoId(Long id) throws JSONException, Exception {
		JSONObject jsonObj = JsonUtil.getJSON(Retriever.URL_NEWS_CONTENT+"?id="+id);
		NewsContent content = new NewsContent();
		JsonUtil.convertJsonToObj(content, jsonObj);
		return content;
	}

	

}
